﻿using Microsoft.AspNetCore.Mvc;
using Qzb.MicroService.Interface;
using Qzb.MicroService.Model;

namespace Qzb.MicroService.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly IUserService _userService;

        public UserController(IUserService userService)
        {
            _userService = userService;
        }

        [HttpGet()]
        [Route("List")]
        public IEnumerable<User> GetUsers()
        {
            Console.WriteLine(HttpContext.Request.Path);

            return _userService.GetUsers();
        }

        [HttpGet()]
        [Route("Get")]
        public User? GetUser(int id)
        {
            Console.WriteLine(HttpContext.Request.Path);

            return _userService.GetUser(id);
        }
    }
}
